package com.ruoyi.yljf.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.yljf.mapper.ExerciseQuestionMapper;
import com.ruoyi.yljf.domain.ExerciseQuestion;
import com.ruoyi.yljf.service.IExerciseQuestionService;

import javax.annotation.Resource;

/**
 * 练习题Service业务层处理
 * 
 * @author metaee
 * @date 2025-04-25
 */
@Service
public class ExerciseQuestionServiceImpl extends ServiceImpl<ExerciseQuestionMapper, ExerciseQuestion> implements IExerciseQuestionService {
    @Resource
    private ExerciseQuestionMapper exerciseQuestionMapper;
    
    /**
     * 查询练习题列表
     * 
     * @param exerciseQuestion 练习题
     * @return 练习题
     */
    @Override
    public List<ExerciseQuestion> selectExerciseQuestionList(ExerciseQuestion exerciseQuestion) {
    	LambdaQueryWrapper<ExerciseQuestion> queryWrapper = Wrappers.lambdaQuery();
        if (StringUtils.isNotNull(exerciseQuestion.getCourseId())) {
			queryWrapper.eq(ExerciseQuestion::getCourseId, exerciseQuestion.getCourseId());
		}
        if (StringUtils.isNotNull(exerciseQuestion.getPackageId())) {
			queryWrapper.eq(ExerciseQuestion::getPackageId, exerciseQuestion.getPackageId());
		}
        if (StringUtils.isNotNull(exerciseQuestion.getQuestionId())) {
			queryWrapper.eq(ExerciseQuestion::getQuestionId, exerciseQuestion.getQuestionId());
		}
        if (StringUtils.isNotEmpty(exerciseQuestion.getSort())) {
			queryWrapper.eq(ExerciseQuestion::getSort, exerciseQuestion.getSort());
		}
        return exerciseQuestionMapper.selectList(queryWrapper);
    }
}
